const path = require('path')
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const vueConifg = {
  extractCSS: process.env.NODE_ENV === 'production',
  preserveWhitespace: false,
  postcss: [
    require('autoprefixer')({
      browsers: ['last 3 versions']
    })
  ]
}

const config = {
  context: path.join(__dirname, ''),
  entry: './entry-client.js',
  output: {
    path: path.join(__dirname,'dist'),
    filename: '[name].client.js'
  },
  devtool: 'source-map',
  module: {
    rules: [{
      test: /\.js$/,
      use: [{
        loader: 'babel-loader'
      }],
      exclude: /node_modules(?!(\/|\\).*(weex).*)/
    },{
      test: /\.vue(\?[^?]+)?$/,
      use: [{
        loader: 'vue-loader',
        options: {
          compilerModules: [
            {
              postTransformNode: el => {
                el.staticStyle = `$processStyle(${el.staticStyle})`
                el.styleBinding = `$processStyle(${el.styleBinding})`
              }
            }
          ]
        }
      }]
    }]
  },
  plugins: [
    new VueSSRClientPlugin()
  ]
}
module.exports = config